package leetcode.slidwidow;

import java.util.Arrays;
import java.util.HashSet;

public class Lc2274 {

    public int maxConsecutive(int bottom, int top, int[] special) {

        int n = special.length;
        Arrays.sort(special);
        int ans = special[0] - bottom;
        ans = Math.max(ans, top - special[n-1]);
        for (int i = 1; i < n; i++) {
            ans = Math.max(ans, special[i] - special[i-1] - 1);
        }
        return ans;
    }


}
